<template>
	<view class="bg">
		
		<view class="top flex-row-center">
			接单地址：
			<u--input placeholder="请输入接单地址" border="surround" v-model="serve_site" ></u--input>
			
		</view>
		<view class="top flex-row-center">
		最低消费：
			<u--input placeholder="请输入最低消费" border="surround" v-model="serve_minimum"></u--input>
			
		</view>
	

	<view  class="submit fixed-bottom" @click="updateServeData()">
				确定
			</view>
			
			</view>
</template>

<script>
	import {
		updateServe,
		getMyIndex,
	} from "./api.js"
	export default {

		data() {
			return {
	serve_site:'',
	serve_minimum:''
			}
		},
		onLoad() {
			this.getMyIndexData()
		},


		methods: {
			updateServeData(){
				let that = this
				var data={
					serve_site:this.serve_site,
					serve_minimum:this.serve_minimum,
				}
				updateServe(data).then(res => {
							uni.showToast({
								title:res.msg,
								icon:'none'
							})
							    setTimeout(() => {
										uni.navigateBack()
							                }, 2000)
	
							
							
				})
			},
			// 获取个人信息
			getMyIndexData() {
				/* uni.showLoading({
					title: '加载中'
				}) */
				let that = this
				let token = uni.getStorageSync("token")
				getMyIndex({
					openid: token
				}).then(res => {
				console.log(res)
			this.serve_site=res.data.serve_site
			this.serve_minimum=res.data.serve_minimum
			
				})
			},

		}
	}
</script>

<style scoped lang="less">
	page{
		background-color: #ffffff
	}
		.top {
			margin-left: 5%;
			margin-top: 50rpx;
			width: 90%;
			// background-color: #ffffff;
			margin-bottom: 30rpx;
		}
		.submit {
			width: 686rpx;
			height: 96rpx;
			background: #0DA17D ;
			border-radius: 50rpx;
			font-weight: 400;
			color: #FFFFFF;
			line-height: 96rpx;
			text-align: center;
			margin: 0 auto;
			margin-bottom: 20rpx;
		}
	

</style>
